package com.feather.tenia.adapter.data;

import com.feather.common.data.Column;
import com.feather.common.data.DataColumn;
import com.feather.common.data.DataItemType;

/**
 * @author flogyin
 */
public class Bytearray_DataColumn implements DataColumn, java.io.Serializable {
	private static final long	serialVersionUID	= 1L;

	private Column				column;
	private byte[]				data;

	public Bytearray_DataColumn(Column column) {
		this.column = column;
	}

	@Override
	public DataItemType getItemType() {
		return DataItemType.DataColumnItem;
	}

	@Override
	public Column getColumn() {
		return this.column;
	}

	@Override
	public boolean asBoolean() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public boolean getBoolean() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public void setBoolean(boolean value) {
		throw new RuntimeException("Not support.");
	}

	@Override
	public String asString() {
		String temp = getString();
		return temp != null ? temp : "";
	}

	@Override
	public String getString() {
		return this.data != null ? new String(this.data) : null;
	}

	@Override
	public void setString(String value) {
		throw new RuntimeException("Not support.");
	}

	@Override
	public byte asByte() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public byte getByte() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public void setByte(byte value) {
		throw new RuntimeException("Not support.");
	}

	@Override
	public byte[] getBytes() {
		return this.data;
	}

	@Override
	public void setBytes(byte[] value) {
		this.data = value;
	}

	@Override
	public short asShort() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public short getShort() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public void setShort(short value) {
		throw new RuntimeException("Not support.");
	}

	@Override
	public int asInt() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public int getInt() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public void setInt(int value) {
		throw new RuntimeException("Not support.");
	}

	@Override
	public float asFloat() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public float getFloat() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public void setFloat(float value) {
		throw new RuntimeException("Not support.");
	}

	@Override
	public long asLong() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public long getLong() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public void setLong(long value) {
		throw new RuntimeException("Not support.");
	}

	@Override
	public double asDouble() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public double getDouble() {
		throw new RuntimeException("Not support.");
	}

	@Override
	public void setDouble(double value) {
		throw new RuntimeException("Not support.");
	}

	@Override
	public Object getObject() {
		return this.data;
	}

	@Override
	public void setObject(Object value) {
		if ((value == null) || (value instanceof byte[]))
			this.data = ((byte[]) value);
		else
			throw new RuntimeException("Not support.");
	}
}
